/*
    This class is a basic extension of the Dialog class.  It can be used
    by subclasses of Frame.  To use it, create a reference to the class,
    then instantiate an object of the class (pass 'this' in the constructor),
    and call the show() method.

    example:

    CIOErrorDlg theCIOErrorDlg;
    theCIOErrorDlg = new CIOErrorDlg(this);
    theCIOErrorDlg.show();

    You can add controls to AboutBox with Cafe Studio.
    (Menus can be added only to subclasses of Frame.)
 */

package compiler;
import java.awt.Button;
import java.awt.Dialog;
import java.awt.Event;
import java.awt.Frame;
import java.awt.Label;
import java.awt.Rectangle;

public class CIOErrorDlg extends Dialog {

    public CIOErrorDlg(Frame parent, String str) {

	    super(parent, "CIOErrorDlg dialog", true);

	    //{{INIT_CONTROLS
        setLayout(null);
        addNotify();
        resize(insets().left + insets().right + 394, insets().top + insets().bottom + 186);
        button1=new Button("Ok");
        add(button1);
        button1.reshape(insets().left + 144,insets().top + 120,72,24);
        label1=new Label("I/O operation fails, Please check it !", Label.CENTER);
        add(label1);
        label1.resize(label1.preferredSize());
        label1.move(18,40);
        //lblReason=new Label("Label");
        //lblReason.setFont(new Font("Dialog",Font.BOLD,10));
        //add(lblReason);
        //lblReason.reshape(insets().left + 36,insets().top + 72,297,32);
        //}}
    	setResizable(false);
    }

    public synchronized void show() {
    	Rectangle bounds = getParent().bounds();
    	Rectangle abounds = bounds();

    	move(bounds.x + (bounds.width - abounds.width)/ 2,
    	     bounds.y + (bounds.height - abounds.height)/2);

    	super.show();
    }

    public synchronized void wakeUp() {
    	notify();
    }

    public boolean handleEvent(Event event) {

    if (event.id == Event.ACTION_EVENT && event.target == button1) {
		clickedOKButton();
		return true;
	}
	else if (event.id == Event.WINDOW_DESTROY) {
	    hide();
	    return true;
	}
    return super.handleEvent(event);
    }

    public void clickedOKButton() {
	handleEvent(new Event(this, Event.WINDOW_DESTROY, null));
    }

    //{{DECLARE_CONTROLS
    Button button1;
    Label label1;
    Label lblReason;
    //}}
}


